/*
 * @Author: liu.ff 
 * @Date: 2018-09-12 14:20:40 
 * @Last Modified by: liu.ff
 * @Last Modified time: 2018-09-13 13:59:58
 */


// 导入组件
import React, {Component} from 'react'
import {
	View,
	Text,
	Image,
	StyleSheet
} from 'react-native'

// import { createBottomTabNavigator } from 'react-navigation' // 2.xx版本
import {TabNavigator} from 'react-navigation'  //1.55.1版本

import TabBarItem from './LFTabBarItem'

/*导入四大模块的导航组件*/
import HomeNav from '../../Home/LFHomeNav'
import ShopNav from '../../Shop/LFShopNav'
import MineNav from '../../Mine/LFMineNav'
import MoreNav from '../../More/LFMoreNav'

/*导入图片资源组件*/
import {LFImages} from '../../../src/img';

// const RootTabNavigator = createBottomTabNavigator(
const RootTabNavigator = TabNavigator(
	{
		homeTab: {
			screen: HomeNav,
			navigationOptions: {
				tabBarLabel: '首页',
				tabBarIcon: ({tintColor, focused}) => (
					<TabBarItem
						color={tintColor}
						selected={focused}
						normalImg={LFImages.icon_tabbar_homepage}
						selectedImg={LFImages.icon_tabbar_homepage_selected}>
					</TabBarItem>
				)
			}
		},

		shopTab: {
			screen: ShopNav,
			navigationOptions: {
				tabBarLabel: '商店',
				tabBarIcon: ({tintColor, focused}) => (
					<TabBarItem
						color={tintColor}
						selected={focused}
						normalImg={LFImages.icon_tabbar_merchant_normal}
						selectedImg={LFImages.icon_tabbar_merchant_selected}>
					</TabBarItem>
				),
			}
		},

		mineTab: {
			screen: MineNav,
			navigationOptions: {
				tabBarLabel: '我的',
				tabBarIcon: ({tintColor, focused}) => (
					<TabBarItem
						color={tintColor}
						selected={focused}
						normalImg={LFImages.icon_tabbar_mine}
						selectedImg={LFImages.icon_tabbar_mine_selected}>

					</TabBarItem>
				),
			}
		},
		moreTab: {
			screen: MoreNav,
			navigationOptions: {
				tabBarLabel: '更多',
				tabBarIcon: ({tintColor, focused}) => (
					<TabBarItem
						color={tintColor}
						selected={focused}
						normalImg={LFImages.icon_tabbar_misc}
						selectedImg={LFImages.icon_tabbar_misc_selected}>

					</TabBarItem>
				),
			}
		},
	},

	{
		tabBarOptions: {
			//当前选中的tab bar的文本颜色和图标颜色
			activeTintColor: '#090',
			//当前未选中的tab bar的文本颜色和图标颜色
			inactiveTintColor: '#000',
			//是否显示tab bar的图标，默认是false
			showIcon: true,
			//showLabel - 是否显示tab bar的文本，默认是true
			showLabel: true,
			//是否将文本转换为大小，默认是true
			upperCaseLabel: false,
			//material design中的波纹颜色(仅支持Android >= 5.0)
			pressColor: '#788493',
			//按下tab bar时的不透明度(仅支持iOS和Android < 5.0).
			pressOpacity: 0.8,
			//tab bar的样式
			style: {
				backgroundColor: '#fff',
				paddingBottom: 1,
				borderTopWidth: 0.2,
				paddingTop: 1,
				borderTopColor: '#ccc',
			},
			//tab bar的文本样式
			labelStyle: {
				fontSize: 11,
				margin: 1
			},
			//tab 页指示符的样式 (tab页下面的一条线).
			indicatorStyle: {height: 0},
		},
		//tab bar的位置, 可选值： 'top' or 'bottom'
		tabBarPosition: 'bottom',
		//是否允许滑动切换tab页
		swipeEnabled: true,
		//是否在切换tab页时使用动画
		animationEnabled: false,
		//是否懒加载
		lazy: true,
		//返回按钮是否会导致tab切换到初始tab页？ 如果是，则设置为initialRoute，否则为none。 缺省为initialRoute。
		backBehavior: 'none',
	}
)

export default RootTabNavigator